import {
  RemarkModel,
  ReportModel,
  GroupScoreModel,
  ScoreModel,
  IntershipInfoModel,
} from "/@/api/model/practicalModel";
import { defHttp } from "/@/utils/http/axios";

enum Api {
  GetInfo = "/internInfo/getInfo",
  GetRemark = "/internInfo/getRemark",
  GetReport = "/internInfo/getReport",
  SaveOrUpdate = "/interInfo/saveOrUpdate",
  SetSummary = "/internInfo/setSummary",
  SetZxRemark = "/internInfo/remark/sch",
  SetGxRemark = "/internInfo/remark/univ",
  GetGroupScore = "/internInfo/getScore/group",
  GetLessonPlanScore = "/internInfo/getScore/lessonPlan",
  GetLectureNoteScore = "/internInfo/getScore/lectureNote",
  GetTeacherMoralScore = "/internInfo/getScore/teacherMoral",
  GetTeachingStudyScore = "/internInfo/getScore/teachingStudy",
  SetGroupScore = "/internInfo/setScore/group",
  SetLessonPlanScore = "/internInfo/setScore/lessonPlan",
  SetLectureNoteScore = "/internInfo/setScore/lectureNote",
  SetTeacherMoralScore = "/internInfo/setScore/teacherMoral",
  SetTeachingStudyScore = "/internInfo/setScore/teachingStudy",
}

export const getInfoApi = () => defHttp.get<IntershipInfoModel>({ url: Api.GetInfo });

export const getInfoByUserIdApi = (userId: number) =>
  defHttp.get<IntershipInfoModel>({ url: `${Api.GetInfo}/${userId}` });

export const getRemarkApi = () => defHttp.get<RemarkModel>({ url: Api.GetRemark });

export const getRemarkByUserIdApi = (userId: number) =>
  defHttp.get<RemarkModel>({ url: `${Api.GetRemark}/${userId}` });

export const getReportApi = () => defHttp.get<ReportModel>({ url: Api.GetReport });

export const getReportByUserIdApi = (userId: number) =>
  defHttp.get<ReportModel>({ url: `${Api.GetReport}/${userId}` });

export const saveOrUpdateInternInfoApi = (params: IntershipInfoModel) =>
  defHttp.post<void>({ url: Api.SaveOrUpdate, params });

export const setSummaryApi = (content: string) =>
  defHttp.put<void>({ url: Api.SetSummary, params: { content } });

export const setZxRemarkApi = (userId: number, content: string) =>
  defHttp.put<void>({ url: `${Api.SetZxRemark}/${userId}`, params: { content } });

export const setGxRemarkApi = (userId: number, content: string) =>
  defHttp.put<void>({ url: `${Api.SetGxRemark}/${userId}`, params: { content } });

export const getGroupScoreApi = (userId: number) =>
  defHttp.get<GroupScoreModel>({ url: `${Api.GetGroupScore}/${userId}` });

export const getLessonPlanScoreApi = (userId: number) =>
  defHttp.get<ScoreModel>({ url: `${Api.GetLessonPlanScore}/${userId}` });

export const getLectureNoteScoreApi = (userId: number) =>
  defHttp.get<ScoreModel>({ url: `${Api.GetLectureNoteScore}/${userId}` });

export const getTeacherMoralScoreApi = (userId: number) =>
  defHttp.get<ScoreModel>({ url: `${Api.GetTeacherMoralScore}/${userId}` });

export const getTeachingStudyScoreApi = (userId: number) =>
  defHttp.get<ScoreModel>({ url: `${Api.GetTeachingStudyScore}/${userId}` });

export const setGroupScore = (userId: number, score: number, remark: string) =>
  defHttp.put<void>({ url: `${Api.SetGroupScore}/${userId}`, params: { score, remark } });

export const setLessonPlanScore = (userId: number, schScore: number, univScore: number) =>
  defHttp.put<void>({
    url: `${Api.SetLessonPlanScore}/${userId}`,
    params: { schScore, univScore },
  });

export const setLectureNoteScore = (userId: number, schScore: number, univScore: number) =>
  defHttp.put<void>({
    url: `${Api.SetLectureNoteScore}/${userId}`,
    params: { schScore, univScore },
  });

export const setTeacherMoralScore = (userId: number, schScore: number, univScore: number) =>
  defHttp.put<void>({
    url: `${Api.SetTeacherMoralScore}/${userId}`,
    params: { schScore, univScore },
  });

export const setTeachingStudyScore = (userId: number, schScore: number, univScore: number) =>
  defHttp.put<void>({
    url: `${Api.SetTeachingStudyScore}/${userId}`,
    params: { schScore, univScore },
  });
